package com.lzw.breezeNovel.webApp.controller.novel;

import com.lzw.breezeNovel.common.result.Result;
import com.lzw.breezeNovel.model.entity.pojo.novel.BookRanking;
import com.lzw.breezeNovel.model.entity.query.PaginationResultQuery;
import com.lzw.breezeNovel.webApp.service.novel.BookRankingService;
import com.lzw.breezeNovel.webApp.vo.novel.BookVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.controller
 * @date 2025/3/3
 * @description 评分表
 */
@RestController
@RequestMapping("/app/bookRating")
@SuppressWarnings("all")
public class BookRatingController {

    /**
     * 注入服务层
     */
    @Autowired
    private BookRankingService bookRatingService;

    /**
     * 获取最新的排行榜信息
     */
    @GetMapping("/getRanking")
    public Result<List<BookVo>> getRanking() {
        List<BookVo> bookVoList = bookRatingService.getRanking();
        return Result.ok(bookVoList);
    }

    //根据排行类型查询分页查询数据
    @PostMapping("/getRankingByPage")
    public Result<PaginationResultQuery<BookVo>> getRankingByPage(@RequestBody BookRanking bookRanking) {
        PaginationResultQuery<BookVo> page = bookRatingService.getRankingByPage(bookRanking);
        return Result.ok(page);
    }

}
